<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>随机点名</title>
    <link rel="stylesheet" href="./font_5884xr46kn/iconfont.css">
    <style>
        body {
            display: flex;

            flex-direction: row;
            align-items: center;
            justify-content: center;
            background-image: url("./bj.jpg");
            background-size: cover;
            object-fit: scale-down;
            overflow: hidden;

        }

        html, body {
            height: 100%;
            width: 100%;
            overflow: hidden;
        }

        .dl {
            width: 500px;
            height: 300px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            align-items: center;
            background: rgba(255, 255, 255, .2);
            -webkit-backdrop-filter: blur(5px);
            backdrop-filter: blur(5px);
            border-radius: 20px;
        }

        .number {
            font-size: 100px;
        }

        .number-container {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
        }

        .button-container {
            height: 80px;
            width: 200px;
            display: flex;
            justify-content: center;
        }

        #start {
            background: linear-gradient(to bottom right, #775bf4, #ec71f4);
            border: none;
            color: white;
            padding: 10px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin-bottom: 30px;

            cursor: pointer;
            border-radius: 12px;
            transition: background-color 0.3s;
        }

        #icon {
            position: absolute;
            top: 20px;
            right: 20px;
        }

        #icons {
            background: none;
            border: none;
            cursor: pointer;
            padding: 8px;
            border-radius: 50%;
            transition: background-color 0.3s;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        #icons:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }

        #icons .iconfont {
            font-size: 24px;
            color: #775bf4;
            transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        #icons.active .iconfont {
            transform: rotate(90deg);
        }

        /* 修改设置面板样式 */
        .settings-panel {
            position: absolute;
            top: -90px;
            right: 0;
            width: 200px;
            height: 60px;
            background: rgba(255, 255, 255, .4);
            backdrop-filter: blur(10px);
            border-radius: 10px;
            padding: 10px;
            display: block;
            opacity: 0;
            transform: translateY(20px);
            pointer-events: none;
            transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0);
            transform-origin: bottom right;
        }

        .settings-panel.active {
            opacity: 1;
            transform: translateY(0) scale(1);
            pointer-events: auto;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
        }

        .settings-item {
            margin-bottom: 10px;
        }

        .settings-item label {
            display: block;
            margin-bottom: 6px;
            color: #2c2c2c;
            font-size: 14px;
            font-weight: 600;
            text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
        }

        .settings-item input {
            width: calc(100% - 16px);
            padding: 8px;
            border: 1px solid rgba(119, 91, 244, 0.3);
            border-radius: 6px;
            background: rgba(255, 255, 255, 0.7);
            outline: none;
            font-size: 14px;
            color: #333;
            transition: all 0.3s ease;
        }

        .settings-item input:focus {
            border-color: #775bf4;
            background: rgba(255, 255, 255, 0.9);
            box-shadow: 0 0 0 3px rgba(119, 91, 244, 0.1);
        }
    </style>
</head>
<body>
<div class="dl">
    <div id="icon">
        <button id="icons">
            <span class="iconfont icon-shezhi"></span>
        </button>
    </div>
    <!-- 添加设置面板 -->
    <div class="settings-panel">
        <div class="settings-item">
            <label>最大人数</label>
            <input type="number" id="maxNumber" value="55" min="1">
        </div>
    </div>
    <div class="number-container">
        <span class="number" id="number">0</span>
    </div>
    <div class="button-container">
        <button id="start">开始</button>
    </div>
</div>
<script>
    // 获取当前最大人数
    let maxNum = 55;

    // 设置按钮点击事件
    document.getElementById("icons").onclick = () => {
        const settingsPanel = document.querySelector('.settings-panel');
        const settingsIcon = document.getElementById('icons');
        settingsPanel.classList.toggle('active');
        settingsIcon.classList.toggle('active');
    };

    // 监听最大人数输入变化
    document.getElementById("maxNumber").addEventListener('change', (e) => {
        maxNum = parseInt(e.target.value) || 55;
    });

    document.getElementById("start").onclick = (e) => {
        if (this.intervalId) {
            clearInterval(this.intervalId);
            this.intervalId = null;
            e.target.innerHTML = "开始";
            console.log('定时器已停止');
        } else {
            this.intervalId = setInterval(() => {
                // 使用设置的最大人数
                document.getElementById("number").innerHTML = 
                    (Math.floor(Math.random() * maxNum) + 1).toString();
                e.target.innerHTML = "结束";
            }, 100);
        }
    };
</script>
</body>
</html>